package day04;

import java.util.Scanner;

public class DoWhileDemo {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("游戏开始，请输入你猜的数字");
        int a =(int) (Math.random()*1000+1);
        //第一要素

        int b;
        do {
            b = scanner.nextInt();
            if (b>a){
                System.out.println("猜大了，还剩"+"次机会"+"请继续猜");
            }else if (b<a){
                System.out.println("猜小了，还剩"+"次机会"+"请继续猜");
            }
        }while (a != b);
        System.out.println("猜对了");
    }
}
